#include <opencv2\opencv.hpp>
#include <cuda_runtime.h>


class LabelEquivalenceSeg{
public:
		//parameter
		typedef struct n_label{
			float4 normal;
			int label;
		};

        LabelEquivalenceSeg(int width, int height);
        ~LabelEquivalenceSeg();

        void labelImage(float4* in);
		void labelImage(float4* cluster_nd_device, int* cluster_label_device);
        void viewSegmentResult();
//        void copyData(bool* boundary, int* label);

        int* getLabelMap() const;
        bool* getBoundaryMap() const;
		void releaseVideo();

private:
        void initialize(float4* in);
        void scan(int* cluster_label_device);
        void analysis(int* cluster_label_device);
        void postProcess(int* cluster_label_device);
                        

        int width;
        int height;
		//parameter for all points
        n_label *img, *temp;
        int* label;
        int *ref, *ref_host;
        int* counter;

        
        bool* boundary_device;
        bool* boundary_host;

        cv::Mat_<cv::Vec3b> show;
        cv::VideoWriter			Writer;
		unsigned char** color_pool;
};